﻿using RecruitmentAgency.Models.Validation;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Web.Mvc;
using RecruitmentAgency.Models.DataTypes;

namespace RecruitmentAgency.Tests.Models.Validation
{
    /// <summary>
    ///This is a test class for JobProviderValidatorTest and is intended
    ///to contain all JobProviderValidatorTest Unit Tests
    ///</summary>
    [TestClass()]
    public class JobProviderValidatorTest
    {
        private const string selectMessage = "Please select an option from the list";
        private ModelStateDictionary modelState;
        private JobProviderValidator target;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext { get; set; }

        /// <summary>
        ///Initialises test members
        ///</summary>
        [TestInitialize]
        public void Initialize()
        {
            modelState = new ModelStateDictionary();
            target = new JobProviderValidator(modelState, selectMessage);
        }

        /// <summary>
        ///A test for ValidateJobProvider
        ///</summary>              
        [TestMethod]
        public void ValidateJobProviderTest()
        {
            // expected to pass
            bool expected = true;
            bool actual = target.ValidateJobProvider(new JobProvider
            {
                AddressLine1 = "AddressLine1",
                AddressLine2 = "AddressLine2",
                CompanyName = "CompanyName",
                ConfirmPassword = "Password",
                Email = "email@email.com",
                FirstName = "FirstName",
                LastName = "LastName",
                Password = "Password",
                Phone = "1123123131231",
                PostCode = "Postcode",
                RegistrationNumber = "12321423423423",
                Sector = "IT",
                Title = "Mr",
                Town = "Town",
                UserName = "Username",
                WebsiteUrl = "www.websiteurl.com"
            });
            Assert.AreEqual(expected, actual);
        }
    }
}